<template>
  <div>
    <div v-for="i in xiaoshuo" :key="i.id">
      <ul>
        <li v-if="i.status==1">{{ i.name }}+++++++++未审核</li>
        <li v-else-if="i.status==2">{{ i.name }}++++++++审核通过</li>
        <li v-else>{{ i.name }}++++++++审核未通过</li>
      </ul>
    </div>
    <div id="main" style="width:800px;height:500px"></div>
  </div>
</template>

<script>
import axios from 'axios'
import * as echarts from "echarts";

export default {
  name: "show_xiaoshuo",
  data() {
    return {
      xiaoshuo: [],
      userid: localStorage.getItem('userid'),
      list1: [],
      list2:[]
    }
  },
  methods: {
    show() {
      axios.get('/zuoye/xiaoshuo?userid=' + this.userid).then(res => {
        this.xiaoshuo = res.data.list
      })

    },
    get_zjifen() {
      axios.get('/zuoye/zjifen?userid=' + this.userid).then(res => {
        this.list1 = res.data.list1
        this.list2 = res.data.list2
        this.show_jilu()
      })
    },
    show_jilu() {
      var chartDom = document.getElementById('main');
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        xAxis: {
          type: 'category',
          data: this.list2
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: this.list1,
            type: 'line'
          }
        ]
      };

      option && myChart.setOption(option);
    }
  },
  mounted() {
    this.show()

    this.get_zjifen()
  }
}
</script>

<style scoped>

</style>